home *** CD-ROM | disk | FTP | other *** search
- property pNetID, pResult, pStartAction, pExitFrameDone, pWhichEvent, pURL, pTicks, pEndTicks
-
- on getPropertyDescriptionList
- set description to [:]
- addProp(description, #pWhichEvent, [#default: #mouseUp, #format: #symbol, #comment: "On Which Event:", #range: [#mouseUp, #exitFrame]])
- addProp(description, #pURL, [#default: "http://<put URL here> ", #format: #string, #comment: "URL:"])
- addProp(description, #pResult, [#default: 1, #format: #integer, #comment: "Channel number of field:"])
- addProp(description, #pTicks, [#default: 60, #format: #integer, #comment: "Timeout seconds:"])
- return description
- end
-
- on getBehaviorDescription
- return "GetNetText Behavior"
- end
-
- on getAssocMembers
- set myPropList to []
- return myPropList
- end
-
- on beginSprite me
- set pStartAction to 0
- end
-
- on mouseUp
- if pStartAction = 0 then
- set pNetID to getNetText(pURL)
- cursor(4)
- set pStartAction to 1
- set pEndTicks to pTicks
- set pEndTicks to pEndTicks * 60
- set pEndTicks to the ticks + pEndTicks
- end if
- end
-
- on prepareFrame me
- if pWhichEvent = #mouseUp then
- finishOperation()
- end if
- end
-
- on exitFrame me
- if (pWhichEvent = #exitFrame) and (not pExitFrameDone = 1) then
- if not pStartAction = 1 then
- set pNetID to getNetText(pURL)
- cursor(4)
- set pStartAction to 1
- set pEndTicks to pTicks
- set pEndTicks to pEndTicks * 60
- set pEndTicks to the ticks + pEndTicks
- end if
- if pStartAction = 1 then
- finishOperation()
- go(the frame)
- end if
- end if
- end
-
- on finishOperation me
- if (pStartAction = 1) and (the ticks > pEndTicks) then
- netAbort(pNetID)
- set outputMember to the member of sprite pResult
- set the text of outputMember to "Timeout!"
- set pStartAction to 0
- set pExitFrameDone to 1
- cursor(0)
- else
- if (pStartAction = 1) and (netDone(pNetID) = 1) then
- if not (netError(pNetID) = EMPTY) then
- if (netError() = "OK") or (netError() = "none") then
- set outputMember to the member of sprite pResult
- set the text of outputMember to netTextResult(pNetID)
- set pStartAction to 0
- set pExitFrameDone to 1
- cursor(0)
- else
- set outputMember to the member of sprite pResult
- set the text of outputMember to netError()
- set pStartAction to 0
- set pExitFrameDone to 1
- cursor(0)
- end if
- end if
- end if
- end if
- end
-